package STUDENT.TRINHQUANGXUANDUC.OPPS.INHERISTANCE.BAI5;

public class Controllers {
	Models models = new Models();

	public void tinhToan(Pheptinh obj) {
		if (models.KTchiacho0(obj)) {
			if (models.ktchia0(obj)) {
				if (models.checkPT(obj)) {
					if (obj.getPheptinh() == 1) {
						System.out.println("Ket qua phep cong la: " + models.cong(obj));
					}
					if (obj.getPheptinh() == 2) {
						System.out.println("Ket qua phep tru la: " + models.tru(obj));
					}
					if (obj.getPheptinh() == 3) {
						System.out.println("Ket qua phep nhan la:" + models.nhan(obj));

					}
					if (obj.getPheptinh() == 4) {
						System.out.println("Ket qua phep chia la: " + models.chia(obj));
					}
				} else {
					System.out.println("Ban chua chon phep toan");
				}
			} else {
				System.out.println("Result of function is underfined");
			}
		} else {
			System.out.println("Cannot divide by zero");
		}
	}
}
